package org.study.local.boot.config;

import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 作用描述
 *
 * @author doveylovey
 * @version v1.0.0
 * @email 1135782208@qq.com
 * @date 2024年04月28日
 */
/*@RequiredArgsConstructor
@Configuration
public class WebMvcConfig02 extends WebMvcConfigurationSupport {
    private final LocalFileProperties localFileProperties;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 假如 localFileProperties.getWebPathPrefix() 为 /local/file
        // 加入此配置后，以 http://ip:port/local/file/ 开头的请求地址就会直接访问本地资源，而不请求接口
        // 示例：http://ip:port/local/file/1790979641591123968_face.jpg
        // 示例：http://ip:port/local/file/10/20240516_143712.jpg
        // 示例：http://ip:port/local/file/10/20240516_143712.mp4
        registry.addResourceHandler(localFileProperties.getWebPathPrefix() + "/**").addResourceLocations("file:" + localFileProperties.getUploadFolder());
    }
}*/
